package com.cyt.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.cyt.dao.impl.SPFeiLeiDaoImpl;
import com.cyt.dao.impl.ShangPingSouSuoDaoImpl;
import com.cyt.dao.impl.ShangPingXXDaoImpl;
import com.cyt.dao.impl.ShangPingXXTwoDaoImpl;
import com.cyt.entity.SPFeiLei;
import com.cyt.entity.ShangPingXX;
import com.cyt.entity.XingWengXiZhi;

//产品搜索实现类
public class NewServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
		
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html");
		HttpSession session =request.getSession();

		SPFeiLeiDaoImpl sDao= new SPFeiLeiDaoImpl();//创建对象
	    List <SPFeiLei> list=sDao.getSPFeiLei();//调用方法获得用户集合
	   request.setAttribute("sp", list);//将数据存入request中
		
		String sosuo=request.getParameter("sosuo");
		ShangPingSouSuoDaoImpl sPXXTwo=new ShangPingSouSuoDaoImpl();
		   List <ShangPingXX> suoSou =  sPXXTwo.getShangPingSuo(sosuo);
        request.setAttribute("SuoSou", suoSou);
        session.setAttribute("SuoSou", suoSou);

		request.getRequestDispatcher("NewFile.jsp").forward(request, response);

		
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
